package club.xinghe.servlet.admin;

import club.xinghe.biz.StudentBiz;
import org.apache.ibatis.session.SqlSession;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/DeleteStudentServlet")
public class DeleteStudentServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     int sid= Integer.parseInt ( request.getParameter ( "sid" ) );

        StudentBiz studentBiz=new StudentBiz ();
        boolean result = studentBiz.deleteStudent ( sid );
        if (result){
            request.getRequestDispatcher ( "/ShowStudentServlet" ).forward ( request,response );
        }


    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      doPost ( request,response );
    }
}
